package main

import "fmt"

func main() {
	var arr1 [6]int
	var slice1 []int = arr1[2:5]

	for i := 0; i < len(arr1); i++ {
		arr1[i] = i
	}

	for i := 0; i < len(slice1); i++ {
		fmt.Printf("Slice at %d is %d\n", i, slice1[i])
	}

	fmt.Printf("The length of arr1 is %d\n", len(arr1))
	fmt.Printf("The length of slice1 is %d\n", len(slice1))
	fmt.Printf("The capacity of slice1 is %d\n", cap(slice1))

	slice1 = slice1[0:4]
	for i := 0; i < len(slice1); i++ {
		fmt.Printf("Slice at %d is %d\n", i, slice1[i])
	}
	fmt.Printf("The length of slice1 is %d\n", len(slice1))
	fmt.Printf("The capacity of slice1 is %d\n", cap(slice1))

	b := []string{"g", "o", "l", "a", "n", "g"}
	b1 := b[1:4]
	b2 := b[:2]
	b3 := b[2:]

	// [o l a]
	fmt.Printf("b[1:4] %v\n", b1)

	// [g o]
	fmt.Printf("b[:2] %v\n", b2)

	// [l a n g]
	fmt.Printf("b[2:] %v\n", b3)

}
